#include<iostream>
#include<algorithm>
#include<cstring>
#include<cstdio>
using namespace std;
int main()
{
	double x, x2;
	int y[10] = {0};
	for(int i = 0; i < 4; i++)
	{
//		cin >> x;
		int x3, x4;
		scanf("%d.%d", &x3, &x4);
		x3 *= 100;
        y[i] = x3 + x4;
//		y[i] = x * 100;
	}
	sort(y, y + 4);
	
	int x3, x4;
	scanf("%d.%d", &x3, &x4);
	int z = x3 * 100 + x4;
	
//	cin >> x2;
//	int z = x2 * 100;
	if(z * 3 >= y[1] + y[2] + y[3]) cout << "infinite" << endl;
	else if(z * 3 < y[0] + y[1] + y[2]) cout << "impossible" << endl;
	else
	{
		int t = z * 3 - y[1] - y[2];
		cout << t / 100 << ".";
        t = t % 100;
        if(t < 10) printf("0%d\n", t);
        else cout << t << endl;
	}
	return 0;
}
